/**
 * Created by WYH on 17/4/20.
 */
angular.module('tribalc').service(
    'RentPaymentModel',
    ['TimeFormat' ,function (TimeFormat) {
        var RentPayment = function (object) {

            var self = this;

            init();

            function init() {
                if (object) {
                    self.id = object.id;
                    self.companyId = object.ownerId;
                    self.createTime = object.createTime;
                    self.amount = object.amount;
                    self.bankSerialNum = object.bankSerialNum;
                    self.status = object.status;
                }
            }
        };

        RentPayment.Status = {
            'unverified': 'UNVERIFIED',
            'confirmed': 'CONFIRMED',
            'mismatching':'MISMATCHING'
        };


        RentPayment.prototype.getStatus = function () {
            return {
                "UNVERIFIED":"尚未核检",
                "CONFIRMED": '核验确认通过',
                "MISMATCHING": '核验信息不匹配'
            }[this.status];
        };

        RentPayment.prototype.getCreateTime = function () {
            return this.createTime ? TimeFormat.changeIntToYearTime(this.createTime) : '';
        };

        RentPayment.prototype.setupCreateTime = function (str) {
            this.createTime = TimeFormat.changeYearTimeToInt(str);
        };


        return RentPayment;


}]);